<!DOCTYPE html>
<html>

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        body,
        html {
            height: 100%;
            margin: 0;
            font-family: Arial, Helvetica, sans-serif;
        }
        * {
            box-sizing: border-box;
        }

        /* 图片部分使用模糊特效:   */
        .bg-image {
            background-image: url("../img/Tesla\ \(3\).jpeg");
            filter: blur(8px);
            -webkit-filter: blur(8px);
            height: 100%;
            background-position: center;
            background-repeat: no-repeat;
            background-size: cover;
        }

        /* 文字部分 */
        .bg-text {
            background-color: rgb(0, 0, 0);
            background-color: rgba(0, 0, 0, 0.4);
            color: white;
            font-weight: bold;
            border: 3px solid #f1f1f1;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 2;
            width: 80%;
            padding: 20px;
            text-align: center;
        }
    </style>
</head>

<body>

    <div class="bg-image"></div>

    <div class="bg-text">
        <h2>Blurred Background</h2>
        <h1 style="font-size:50px">I am John Doe</h1>
        <p>And I'm a Photographer</p>
    </div>




    <xmp style="font-size: 22px; font-weight: bolder;  margin-bottom: 66px;  color: black;  font-family: '微软雅黑';">
       
        必知必会
       
        ==>  注意,这里不能使用 父子盒子, 
        因为一旦使用父容器使用模糊特效, 那么子容器的文字也会变得模糊
        所以图片和文字的盒子是平级关系
    
    
        <div class="bg-image"></div>

        <div class="bg-text">
            <h2>Blurred Background</h2>
            <h1 style="font-size:50px">I am John Doe</h1>
            <p>And I'm a Photographer</p>
        </div>
    
    
    
        /* 图片部分使用模糊特效:   */
        .bg-image {
            background-image: url("img/Tesla\ \(3\).jpeg");
            filter: blur(8px);
            -webkit-filter: blur(8px);
            height: 100%;
            background-position: center;
            background-repeat: no-repeat;
            background-size: cover;
        }
    
        /* 文字部分 */
        .bg-text {
            background-color: rgb(0, 0, 0);
            background-color: rgba(0, 0, 0, 0.4);
            color: white;
            font-weight: bold;
            border: 3px solid #f1f1f1;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 2;
            width: 80%;
            padding: 20px;
            text-align: center;
        }    
        
    </xmp>



</body>
</html>